package yanivosher.aiproject;

public class Edge implements Cloneable{
	private final String id;
	private final Vertex source;
	private final Vertex destination;
	private final int weight;
	private boolean isBlocked;

	public Edge(String id, Vertex source, Vertex destination, int weight,boolean isBlocked) {
		this.isBlocked = isBlocked;
		this.id = id;
		this.source = source;
		this.destination = destination;
		this.weight = weight;
	}

	public Edge(String id, Vertex source, Vertex destination, int weight) {
		this.id = id;
		this.source = source;
		this.destination = destination;
		this.weight = weight;
	}
	
	public Edge(Edge e) {
		this.isBlocked = e.isBlocked;
		this.id = e.id;
		this.source = e.source;
		this.destination = e.destination;
		this.weight = e.weight;
	}

	public String getId() {
		return id;
	}

	public Vertex getDestination() {
		return destination;
	}

	public Vertex getSource() {
		return source;
	}

	public int getWeight() {
		return weight;
	}

	public boolean getIsBlocked() {
		return isBlocked;
	}
	
	public void setIsBlocked(boolean value) {
		isBlocked = value;
	}

	@Override
	public String toString() {
		return source + " " + destination;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Edge) {
			if(((Edge)obj).id.equals(id)
			&&((Edge)obj).source.equals(source)
			&&((Edge)obj).destination.equals(destination)
			&&((Edge)obj).isBlocked == (isBlocked));
			return false;
		}
		return super.equals(obj);
	}
}